package com.demo.designmode.mediator;

/**
 * @Author: jxm
 * @Description: 中介者模式测试
 * @Date: 2023-12-12 14:17
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        //创建中介者对象
        MediatorStructure mediatorStructure = new MediatorStructure();
        //创建租房者对象
        Tenant tenant = new Tenant("李四",mediatorStructure);
        //创建房主对象
        HouseOwner houseOwner = new HouseOwner("张三", mediatorStructure);
        //中介结构要知道房主和租房者
        mediatorStructure.setTenant(tenant);
        mediatorStructure.setHouseOwner(houseOwner);

        tenant.constact("需要租三室的房子");
        houseOwner.constact("我这有三室的房子，你需要租吗？");
    }
}
